<template>
  <div class="contents">
    <div class="top">
      <div class="tabs">
        <span :class="{'checked': tradeType === 1}" @click="changeTradeType(1)">我要买币</span>
        <span :class="{'checked': tradeType !== 1}" @click="changeTradeType(2)">我要卖币</span>
      </div>
      <div class="tabs2" v-if="tradeType === 1">
        <span :class="{'checked': blockType === 1}" @click="changeBlockType(1)">自选区</span>
        <span :class="{'checked': blockType === 2}" @click="changeBlockType(2)">快捷区</span>
      </div>
    </div>

    <!-- 自选区 -->
    <Choose :tradeType="tradeType" @changeTradeType="changeTradeType" v-if="blockType === 1" />

    <!-- 快捷区 -->
    <Quick @changeTradeType="changeTradeType" v-if="blockType === 2" />
  </div>
</template>

<script>
  const Choose = () => import("@/components/trade/choose");
  const Quick = () => import("@/components/trade/quick");
  export default {
    components: {
      Choose,
      Quick,
    },
    data() {
      return {
        blockType: 1,
        tradeType: 1,
      }
    },
    methods: {
      changeBlockType(val) {
        this.blockType = val;
      },
      changeTradeType(val) {
        this.tradeType = val;
      },
    },
  }
</script>

<style lang="scss" rel="stylesheet/scss" type="text/scss" scoped>
  .contents{
    background: #F0F5FD;
    height: 100%;
    .blueText{
      color: #479FFF;
    }
    .top{
      padding-top: 12px;
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      padding-bottom: 15px;
      .tabs{
        span{
          width: 68px;
          height: 24px;
          font-size: 17px;
          font-weight: Medium;
          text-align: left;
          color: #8f949c;
          line-height: 24px;
          margin: 15px;
        }
        .checked{
          color: #222222;
          position: relative;
          &::after{
            content: '';
            width: 40px;
            height: 5px;
            background: #479fff;
            display: block;
            position: absolute;
            bottom: -6px;
            left: 12px;
          }
        }
      }
      .tabs2{
        display: flex;
        width: 123px;
        height: 27px;
        background: #ffffff;
        border-radius: 13.5px;
        overflow: hidden;
        align-items: center;
        line-height: 27px;
        margin-right: 15px;
        span{
          color: #8f949c;
          width: 50%;
          line-height: 27px;
          font-size: 13px;
          font-weight: Regular;
          text-align: center;
          color: #8f949c;
          line-height: 27px;
        }
        .checked{
          background: #479FFF;
          color: #fff;
          border-radius: 12px;
        }
      }
    }
  }
</style>
